/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cardgame;

import javax.swing.JTabbedPane;
import cardgame.game.Deck;
import com.esotericsoftware.kryonet.*;

/**
 *
 * @author Carl
 */
public class MainFrame extends javax.swing.JFrame{

    public MainFrame(Client client){
        initComponents();
        this.client = client;
        FrameUtil.initWindowSpecials(this);
        FrameUtil.centerFrame(this);
        setTitle(GameInfo.NAME);
        
        tpaneMenu = new JTabbedPane();
        tpaneMenu.add("Deck Editor", new PanDeckEditor());
        panJoin = new PanJoin(this);
        tpaneMenu.add("Join", panJoin);
        add(tpaneMenu);
        
        setSize(528, 580);
        tpaneMenu.setSize(532, 558);
        tpaneMenu.setLocation(-2, -2);
    }
    private Client client;
    private JTabbedPane tpaneMenu;
    private PanJoin panJoin;
    
    public void joinGame(Deck deck){
        tpaneMenu.remove(panJoin);
        PanPlay panPlay = new PanPlay(client, deck);
        tpaneMenu.add("Play", panPlay);
        tpaneMenu.setSelectedComponent(panPlay);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 532, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 534, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
